/**
 * Licensee: DuKe TeAm
 * License Type: Purchased
 */
package ormsamples;

import org.orm.*;
public class DeleteTaller1PDSData {
	public void deleteTestData() throws PersistentException {
		PersistentTransaction t = orm.Taller1PDSPersistentManager.instance().getSession().beginTransaction();
		try {
			orm.Pacient lormPacient = orm.PacientDAO.loadPacientByQuery(null, null);
			// Delete the persistent object
			orm.PacientDAO.delete(lormPacient);
			orm.User lormUser = orm.UserDAO.loadUserByQuery(null, null);
			// Delete the persistent object
			orm.UserDAO.delete(lormUser);
			orm.Doctor lormDoctor = orm.DoctorDAO.loadDoctorByQuery(null, null);
			// Delete the persistent object
			orm.DoctorDAO.delete(lormDoctor);
			orm.BabyMonitor lormBabyMonitor = orm.BabyMonitorDAO.loadBabyMonitorByQuery(null, null);
			// Delete the persistent object
			orm.BabyMonitorDAO.delete(lormBabyMonitor);
			orm.Solution lormSolution = orm.SolutionDAO.loadSolutionByQuery(null, null);
			// Delete the persistent object
			orm.SolutionDAO.delete(lormSolution);
			orm.Diagnose lormDiagnose = orm.DiagnoseDAO.loadDiagnoseByQuery(null, null);
			// Delete the persistent object
			orm.DiagnoseDAO.delete(lormDiagnose);
			orm.Response lormResponse = orm.ResponseDAO.loadResponseByQuery(null, null);
			// Delete the persistent object
			orm.ResponseDAO.delete(lormResponse);
			orm.Question lormQuestion = orm.QuestionDAO.loadQuestionByQuery(null, null);
			// Delete the persistent object
			orm.QuestionDAO.delete(lormQuestion);
			orm.QuestForm lormQuestForm = orm.QuestFormDAO.loadQuestFormByQuery(null, null);
			// Delete the persistent object
			orm.QuestFormDAO.delete(lormQuestForm);
			t.commit();
		}
		catch (Exception e) {
			t.rollback();
		}
		
	}
	
	public static void main(String[] args) {
		try {
			DeleteTaller1PDSData deleteTaller1PDSData = new DeleteTaller1PDSData();
			try {
				deleteTaller1PDSData.deleteTestData();
			}
			finally {
				orm.Taller1PDSPersistentManager.instance().disposePersistentManager();
			}
		}
		catch (Exception e) {
			e.printStackTrace();
		}
	}
}
